package com.xiaohua.system.tool;

import com.xiaohua.common.core.domain.model.LoginUser;
import com.xiaohua.system.domain.XhUsers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 用户工具类
 * 
 * @author 小花
 * @date 2025-03-22
 */
public class UserTool {
    private static final Logger log = LoggerFactory.getLogger(UserTool.class);
    
    /**
     * 创建登录用户对象
     */
    public static LoginUser createLoginUser(XhUsers user) {
        LoginUser loginUser = new LoginUser();
        loginUser.setUserId(user.getUserId());
        
        // 创建SysUser对象存储用户信息
        com.xiaohua.common.core.domain.entity.SysUser sysUser = new com.xiaohua.common.core.domain.entity.SysUser();
        sysUser.setUserId(user.getUserId());
        sysUser.setUserName(user.getUsername());
        sysUser.setNickName(user.getNickname());
        
        // 设置用户对象
        loginUser.setUser(sysUser);
        return loginUser;
    }
} 